//
//  PrescriptionOrderLogisticsCellViewModel.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2021/8/18.
//  Copyright © 2021 QDSG. All rights reserved.
//

import UIKit

class PrescriptionOrderLogisticsSectionViewModel: NSObject {
    let model: PrescriptionOrderLogistics
    
    private var items: [PrescriptionOrderLogisticsCellViewModel]
    
    init(with model: PrescriptionOrderLogistics) {
        self.model = model
        
        let list = model.list ?? []
        
        self.items = list.map { PrescriptionOrderLogisticsCellViewModel(with: $0) }
    }
    
    var numberOfRows: Int { items.count }
    
    var statusTitle: String? { model.name }
    
    func viewModel(at indexPath: IndexPath) -> PrescriptionOrderLogisticsCellViewModel {
        items[indexPath.row]
    }
}

class PrescriptionOrderLogisticsCellViewModel: NSObject {
    let model: PrescriptionOrderLogistics.Detail
    
    init(with model: PrescriptionOrderLogistics.Detail) {
        self.model = model
    }
    
    var opTime: String? { model.opTime }
    
    var opDesc: String? { model.opDesc }
}
